package com.nine.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.nine.dao.AccountMapper;
import com.nine.dao.OrderMapper;
import com.nine.dao.OrderitemsMapper;
import com.nine.dao.PackageMapper;
import com.nine.dao.ProductMapper;
import com.nine.dao.UsersMapper;
import com.nine.dao.VipsMapper;
import com.nine.entity.Account;
import com.nine.entity.ConfirmPaycode;
import com.nine.entity.Order;
import com.nine.entity.Orderitems;
import com.nine.entity.Package;
import com.nine.entity.Product;
import com.nine.entity.Users;
import com.nine.entity.Vips;
import com.nine.service.OrderService;

@Service(value="orderService")
public class OrderServiceImpl implements OrderService {
	@Autowired
	private OrderMapper orderMapper;
	@Autowired
	private VipsMapper vipsMapper;
	@Autowired
	private UsersMapper usersMapper;
	@Autowired
	private AccountMapper accountMapper;
	@Autowired
	private PackageMapper packageMapper;
	@Autowired
	private ProductMapper productMapper;
	@Autowired
	private OrderitemsMapper orderitemsMapper;
	
	
	@Override
	public List<Vips> getAllVips() {
		// TODO Auto-generated method stub
		return vipsMapper.getAllVips();
	}

	@Override
	public Users getOneUser(String username) {
		// TODO Auto-generated method stub
		return usersMapper.getOneUser(username);
	}

	@Override
	public Account getOneAccount(int accountid) {
		// TODO Auto-generated method stub
		return accountMapper.selectByPrimaryKey(accountid);
	}

	@Override
	public Account getOneAccount(ConfirmPaycode confirmPaycode) {
		// TODO Auto-generated method stub
		return accountMapper.getOneAccount(confirmPaycode);
	}

	@Override
	public Vips getOneVip(String viptype) {
		// TODO Auto-generated method stub
		return vipsMapper.getOneVip(viptype);
	}

	@Override
	public int changeVipOrder(Users user) {
		// TODO Auto-generated method stub
		return usersMapper.changeVipOrder(user);
	}

	@Override
	public List<Package> getAllPackage(Package package1) {
		// TODO Auto-generated method stub
		return packageMapper.getAllPackage(package1);
	}

	@Override
	public List<Product> getSomethingProduct(Product product1) {
		// TODO Auto-generated method stub
		return productMapper.getSomethingProduct(product1);
	}

	@Override
	public int addShopping(Order order) {
		// TODO Auto-generated method stub
		return orderMapper.insertSelective(order);
	}

	@Override
	public List<Order> getAllOrders() {
		// TODO Auto-generated method stub
		return orderMapper.getAllOrders();
	}

	@Override
	public int addSingleShopping(Orderitems orderitems) {
		// TODO Auto-generated method stub
		return orderitemsMapper.insertSelective(orderitems);
	}

	@Override
	public int delShopping(Integer id) {
		// TODO Auto-generated method stub
		return orderMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int updateOrderState(Order order) {
		// TODO Auto-generated method stub
		return orderMapper.deleteByPrimaryKey(order.getId());
	}

}
